package pers.xx.sbm.base;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

/**
* @ClassName: Constants 
* @Description: (静态常量) 
* @author zyfine
* @date 2017年4月6日 上午9:33:07 
*
*/
public class Constants {
	

	// 日期时间格式
	public static final String DEFAULT_YEAR_DATETIME_FORMAT = "yyyy";
	public static final String DEFAULT_MONTH_DATETIME_FORMAT = "MM";
	public static final String DEFAULT_FULL_DATETIME_FORMAT = "yyyy-MM-dd";
	public static final String DEFAULT_FULL_DATETIME_FORMAT1 = "yyyy-MM";
	public static final String DEFAULT_SIMPLE_DATE_FORMAT = "yyyy-MM-dd HH24:mi:ss";
	public static final String DEFAULT_SIMPLE_DATE_FORMATJAVA = "yyyy-MM-dd HH:mm:ss";
	public static final String DEFAULT_ERROR_DATETIME = "0000-00-00";

	//系统状态变量
	/**
	 * 可用
	 */
	public static final String ENABLED = "0";
	/**
	 * 不可用
	 */
	public static final String UNENABLED = "1";
	/**
	 * 新增
	 */
	public static final String CREATE = "0";
	/**
	 * 修改
	 */
	public static final String UPDATE = "1";
	/**
	 * 删除
	 */
	public static final String DELETE = "2";


	//编码
	public static final String SYS_ENCODE = "utf-8"; 
	//ajax编码
	public static final String SYS_CONTECTTYPE_JSON = "text/json;charset=UTF-8";
	public static final String SYS_CONTECTTYPE_HTML = "text/html;charset=UTF-8";
		
	public static final String SYS_LINE = File.separator;
	//SVG文件存放路径
	public static final String FILE_SAVE_PATH_SVG = "upload"+SYS_LINE+"svg"+SYS_LINE+"save";
	//SVG临时文件存放路径
    public static final String FILE_TEM_PATH_SVG = "upload"+SYS_LINE+"svg"+SYS_LINE+"tem";
    //图片文件存放路径
	public static final String FILE_SAVE_PATH_PIC="upload"+SYS_LINE+"pic"+SYS_LINE+"save";
	//图片临时文件存放路径
	public static final String FILE_TEM_PATH_PIC="upload"+SYS_LINE+"pic"+ SYS_LINE+"tem";
	//word文件存放路径
	public static final String FILE_SAVE_PATH_DOC="upload"+SYS_LINE+"doc"+SYS_LINE+"save";
	//word临时文件存放路径
	public static final String FILE_TEM_PATH_DOC="upload"+SYS_LINE+"doc"+SYS_LINE+"tem";
	//其他文件的存放目录
	public static final String FILE_SAVE_PATH_FILE="upload"+SYS_LINE+"file"+SYS_LINE+"save";
	
	//批量插入数量
	public static final int  BATCH_NUM = 50000;
	//变换系数
	public static final BigDecimal  PARAM_K = new BigDecimal("10") ;
	//平移量
	public static final BigDecimal  PARAM_C = new BigDecimal("50") ;
	//计算任务数
	public static final int PLAN_NUM=8;
	
	//高低分组
	public static final String GROUP_HIGH = "1"; 
	public static final String GROUP_LOW = "2"; 
	
	//计算类型说明
	public static Map<Integer, String> getPlanMap(){
		Map<Integer, String> conMap = new HashMap<Integer, String>();
		conMap.put(1, "分别统计计算全市范围、各区县范围、各学校范围、各班级范围各学科及多可组合的在籍人数，报名人数，实考人数，标准T分，标准Z分，百分等级，"
				+ "平均分，最高分，最低分，众数，中位数，全距，偏度，峰度，标准差，优秀率，良好率，及格率，低分率。");
		conMap.put(2, "分别统计计算全市范围各科目小题及全卷的平均得分率，标准差，平均得分，难度系数，区分度，高分组平均分，低分组平均分，信度，效度。");
		conMap.put(3, "分别统计计算各区县范围各科目小题的平均得分率。");
		conMap.put(4, "分别统计计算全市范围内各科目选择题的每个选项在全样本、高分组、低分组的被选择比例。");
		conMap.put(5, "分别统计计算全市范围内各科目每道主观题的得分等级在全样本、高分组、低分组的人数比例。");
		conMap.put(6, "分别统计计算全市范围内各科目每道选择题的选项在每个0.01的Z分数区间内的人数比例。");
		conMap.put(7, "分别统计计算全市范围内各科目每道主观题的各得分等级在每个0.01的Z分数区间内的人数比例。");
		conMap.put(8, "分别统计计算全市范围内各科目在每个0.01的Z分数区间内的人数比例。");
		return conMap;
	}
	//计算类型
	public static Map<Integer, String> getPlanTitleMap(){
		Map<Integer, String> conMap = new HashMap<Integer, String>();
		conMap.put(1, "群体指标统计计算");
		conMap.put(2, "科目小题与全卷指标统计计算");
		conMap.put(3, "典型题目指标统计计算");
		conMap.put(4, "客观题选项指标统计计算");
		conMap.put(5, "主观题得分指标统计计算");
		conMap.put(6, "客观题Z分数分布指标统计计算");
		conMap.put(7, "主观题Z分数分布指标统计计算");
		conMap.put(8, "科目Z分数分布指标统计计算");
		return conMap;
	}
	public static StringBuffer EXCEL_CSS = new StringBuffer();
	public static String[] COLOR3 = {"#84CCC9", "#7ECEF4", "#FACD89"};
	public static String[] COLORALL = {"#7CB5ED", "#96C4F1", "#B0D3F4", "#CBE1F8", "#00B7EE", "#33C5F1", "#66D4F5", 
			"#99E2F8", "#009E96", "#33B1AB", "#66C5C0", "#99D8D5", "#98C997", "#A1D4AC", "#C2E8E6"};
	static{
		//导入样式文件
				try {
					File cssFile = new File(PEConstant.class.getResource("../../../../").getFile().toString() + "static/css/satisfaction_chart.css");
					if(cssFile.isFile() && cssFile.exists()){ //判断文件是否存在
						InputStreamReader read = new InputStreamReader(new FileInputStream(cssFile));//考虑到编码格式
						BufferedReader bufferedReader = new BufferedReader(read);
						String lineTxt = null;
						while((lineTxt = bufferedReader.readLine()) != null){
							EXCEL_CSS.append(lineTxt);
						}
						read.close();
					}
				} catch (Exception e) {
					e.printStackTrace();
				}
				EXCEL_CSS.append(".j2{text-indent: 2em;line-height: 150%;font-family:'宋体'; font-size: 12pt;} "
					+ ".title{font-family:'黑体'; font-size: 22pt;font-weight: bold;}"
					+ "h1{font-family:'黑体'; font-size: 16pt;}"
					+ "h2{font-family:'黑体'; font-size: 15pt;}"
					+ "h3{font-family:'黑体'; font-size: 14pt;}"
					+ "h4{font-family:'宋体'; font-size: 12pt;}"
					+ "h5{font-family:'宋体'; font-size: 12pt;}"
					+ "table { text-align: center;font-family:'宋体';}" );
	}

	// 学校类别map
	public static final Map<Integer, String> getSchoolScaleMap(){
		Map<Integer, String> schoolScaleMap = new HashMap<>();
		schoolScaleMap.put(0, "");
		schoolScaleMap.put(1, "一类");
		schoolScaleMap.put(2, "二类");
		schoolScaleMap.put(3, "三类");
		return schoolScaleMap;
	}

	// 学校办别map
	public static final Map<Integer, String> getSchoolNatureMap(){
		Map<Integer, String> schoolNatureMap = new HashMap<>();
		schoolNatureMap.put(0, "");
		schoolNatureMap.put(1, "公办");
		schoolNatureMap.put(2, "民办");
		return schoolNatureMap;
	}

	// 根据分析层级获取机构统称
	public static final Map<Integer, String> getInstitutionName(){
		Map<Integer, String> schoolNatureMap = new HashMap<>();
		schoolNatureMap.put(0, "区县");
		schoolNatureMap.put(1, "学校");
		schoolNatureMap.put(2, "班级");
		return schoolNatureMap;
	}

	// 入出口课程类型名称(d_dn_base_examinfo#course_name)
	public static final  Map<Integer,String> getCourseMap(){
		Map<Integer, String> courseMap = new HashMap<>();
		courseMap.put(0, "综合");
		courseMap.put(1, "文科");
		courseMap.put(2, "一般高中学校");
		return courseMap;
	}

}